<?php $this->headScript()->appendFile($this->JS_PATH . 'subject.js'); ?>
<div id="subject-listing"></div>
<div class="container-fluid">
<div id="pad-wrapper" class="form-page">
    <div class="row-fluid form-wrapper">
        <div class="span column span5">

            <?php if ($this->successmessage != ''): ?>
                <div class="alert alert-success">
                    <i class="icon-ok-sign"></i> <?php echo $this->successmessage; ?>
                </div>
            <?php endif; ?>
            <?php if (count($this->errorMessageArray) > 0): ?>
                <div class="alert alert-error">
                    <?php foreach ($this->errorMessageArray as $erroValue): ?>

                        <div class="text-left">
                            <i class="icon-remove-sign"></i>
                            <?php echo $erroValue; ?>
                        </div>
                    <?php endforeach; ?>
                </div>
            <?php endif; ?>
            <div class ="subject">
                 <h3><?php echo $this->mode;?> <?php echo $this->translate("subject_header"); ?></h3>
                 <br/>
            <form role="form"  id="subject-form" name="subject-form"  enctype="multipart/form-data"  action="" method="post">
                <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_name"); ?><span class="error-star">*</span>:</label>
                    <?php echo $this->form->subj_name; ?>
                </div>


               
               <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_site"); ?><span class="error-star">*</span>:</label>
                        <?php echo $this->form->site_id; ?>
                </div>


                <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_department"); ?><span class="error-star">*</span>:</label>
                        <?php echo $this->form->dep_id; ?>
                </div>
                <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_type"); ?>:</label>
                    <div class="ui-select select_site">
                        <?php echo $this->form->type_id; ?>
                    </div>
                </div>
                <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_delay"); ?><span class="error-star">*</span>:</label>
                    <?php echo $this->form->subj_delay; ?>
                </div>
                
                <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_instruction"); ?><span class="error-star">*</span>:</label>
                        <?php 
                        if ($this->imageName != ""): ?>
                        <?php if (file_exists($this->UPLOAD_PATH . "subject/" . $this->imageName)): ?>
                        <?php $src_image_path = $this->PUBLIC_PATH . "upload/subject/".$this->imageName; ?>
                            <?php
                            $src_path = $this->PUBLIC_PATH . "img/document.png";
                            ?>
                                <img src="<?php echo $src_path; ?>" height="100" width="100"/>    
                                &nbsp;
                                <a class="label label-add" href="<?php echo $src_image_path;?>" target="_blank">
                                View</a>
                    <!--<img src="<?php echo $src_path; ?>" height="200" width="200"/>&nbsp;
                        --><br><?php endif; ?><?php endif; ?>
                        <input type="file" name="subj_instruction" id="subj_instruction">
                </div>
                
                <div class="field-box">
                    <label><?php echo $this->translate("subj_frm_status"); ?><span class="error-star">*</span>:</label>
                    <div class="ui-select">
                    <?php echo $this->form->subj_status; ?>
                    </div> 
                </div>
                <br>
                <div class="field-box">
                    <?php echo $this->form->Save; ?>
                    <?php echo $this->form->Reset; ?> 
                </div>
            </form>
            </div>
        </div>
        
        <!---request callout-->
        <?php if($this->mode == 'Edit'):?>
        <div class="span column span5 ">
            <h3>
            <?php echo $this->translate("callout_subject"); ?>
            </h3><br/>
            <?php echo $this->flashmessages(); ?>
            <div class="pull-right">
                <a href="#myModal" data-toggle="modal" class="btn-flat new-product">+ <?php echo $this->translate("add_callout"); ?> </a>
            </div>
            <br/><br/>
            
            <table class="table table-hover">
                    <thead>
                        <tr>
                            <th class="col-md-3 ">
                                <?php echo $this->translate("call_frm_name"); ?>
                            </th>
                            
                            <th class="col-md-3">
                                <?php echo $this->translate("call_frm_phone"); ?>
                              
                            </th>

                            <th class="col-md-3 ">
                                <?php echo $this->translate("call_frm_comment"); ?>
                            </th>

                            
                            <th class="col-md-3">
                                 <?php echo $this->translate("list_action"); ?>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php if (count($this->calloutData) > 0): ?>
                            <?php $counter = 0; ?>
                            <?php foreach ($this->calloutData as $key => $value) : ?>
                                <tr <?php if ($counter == 0): ?>class="first"<?php endif; ?>>
                                    <td>
                                       <?php echo ucfirst($value['call_person']); ?>
                                        
                                    </td>
                                   
                                    <td class="">
                                        <?php echo ucfirst($value['call_contact_no']); ?>
                                    </td>
                                    
                                    <td class="">
                                        <?php echo $value['call_comment']; ?>
                                    </td>

                                    
                                    <td>
                                        <ul class="actions" style="list-style-type: none;">
                                            
                                            <li class="last">
                                                <a title="Delete" href="<?php echo $this->url(array('controller' => 'subject', 'action' => 'deletecallout', 'call_id' => $value["call_id"],'subj_id' => $value["subj_id"]), null, true); ?>">
                                                    <i class="table-delete"></i>
                                                </a>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <?php $counter++; ?>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <tr class="row2" >
                                <td>&nbsp;</td>
                                <td colspan="8"><?php echo $this->translate("no_record"); ?></td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            
        </div>
        <?php endif;?>
        <!---end request callout-->

        <!-- Add callout Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
              <h4 class="modal-title"><?php echo $this->translate("callout_subject"); ?> </h4>
            
            </div>
            <div class="modal-body">
                <form class="form-horizontal" method="post" role="form" action="<?php echo $this->url(array('controller' => 'subject', 'action' => 'callout', 'subj_id' => $this->subjectid), null, true); ?>">
                   
                    <div class="form-group">
                        <label for="input1" class="col-lg-2 control-label"><?php echo $this->translate("call_frm_name"); ?> :</label>
                        <div class="col-lg-10">
                            <div class="ui-select">
                                <select name="emp_list" id="emp_list">
                                <option value="">Select</option>
                                <?php foreach ($this->CustContData as $key =>$value):?>
                                <option emp_name="<?php echo $value['name'];?>" contact_no="<?php echo $value['contact_no'];?>" value="<?php echo $key;?>"><?php echo $value['name'];?></option>
                                <?php endforeach;?>
                                </select>
                            </div>
                            &nbsp; <input type="hidden" class="form-control" id="call_person" name="call_person" >
                        </div>
                    </div>
                    <br>
                    <div class="form-group">
                        <label for="input1" class="col-lg-2 control-label"><?php echo $this->translate("call_frm_phone"); ?> :</label>
                        <div class="col-lg-10">
                            &nbsp;<input type="text" class="form-control" id="call_contact_no" name="call_contact_no" >
                        </div>
                    </div>
                     <br>
                    <div class="form-group">
                        <label for="input1" class="col-lg-2 control-label">Note :</label>
                        <div class="col-lg-10">
                             &nbsp;<textarea name="call_comment" id="call_comment" rows="3" cols="10"></textarea>
                        </div>
                    </div>
                
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              <button type="submit" class="btn btn-primary">Save changes</button>
            </div>
              </form>
          </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
 <!-- /.modal -->
 
    </div>
</div>
</div>    